import { createStore } from 'vuex'
import axios from '../request'



export default createStore({
  state: {
    num: 1,
    user: {},
  },
  mutations: {
    getUser(store: any, obj: any) {
      store.user = obj
    },

  },
  actions: {
    async Login(store: any, list: string[]) {
      let [name, password] = list
      let res = await axios.post(`/users/login?name=${name}&password=${password}`)
      store.commit('getUser', res.data.list)
      return res.data.code
    }
  },
  getters: {

  }
})